﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System;
using System.Data;
using System.Linq;
using OA.Model;
using OA.Utility;


namespace OA.Bll.Personnel
{
    public class LaborRelationPresenter : BasePresenter<LaborRelationInfo>
    {        
        new public string Paged(JsonReq req)
        {
            //int pageIndex = Convert.ToInt32(req["page"]);
            //int pageSize = Convert.ToInt32(req["rows"]);
            //int total = 0;
            //DataTable table = _manager.GetPaged(pageIndex, pageSize, ref total);
            //string result = JsonHelper.OnDataGrid(table, total);
            //return result;
            return Search(req);
        }
        new public string Search(JsonReq req)
        {
            int pageIndex = Convert.ToInt32(req["page"]);
            int pageSize = Convert.ToInt32(req["rows"]);
            int total = 0;
            //T info = JsonHelper.JsonDeserialize<T>(req.Options);
            string sql = JsonHelper.GetQueryFilterString(req.Options);
            Type type = typeof (LaborRelationInfo);
            if (type.GetProperties().Count(a => a.Name.ToLower() == "createtime") > 0)
                sql += " order by [createtime] desc";
            DataTable dt = new Manager.ManagerParent<LaborRelationViewInfo>().GetSearchPaged(sql, pageIndex, pageSize,
                                                                                             ref total);
            return JsonHelper.OnDataGrid(dt, total);
        }
    }
}
